<%--
  Created by IntelliJ IDEA.
  User: chen
  Date: 2023/3/8
  Time: 13:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>司机列表</title>
    <link href="css/themes/default/easyui.css" rel="stylesheet"/>
    <link href="css/themes/icon.css" rel="stylesheet"/>
    <link href="css/themes/color.css" rel="stylesheet"/>
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="script/jquery.min.js"></script>
    <script src="script/jquery.easyui.min.js"></script>
    <script src="script/easyui-lang-zh_CN.js"></script>

    <style>
        body {
            font-size: 12px;
            overflow-y: hidden;
        }

        input {
            width: 100px;
        }

        select {
            width: 104px;
        }

        #sec {
            /*border:1px solid #0094ff;*/
            width: 1000px;

        }

        #sec td {
            width: 100px;
            height: 20px;
            text-align: right
        }
    </style>
</head>
<body>
<div>
    <table id="sec">
        <tr>
            <td>收件人姓名:</td>
            <td><input type="text" class="easyui-textbox" id="name" name="name"/></td>
            <td>
                <button id="btn" onclick="" class="easyui-linkbutton c1" style="width:70px">查询</button>
            </td>
        </tr>
    </table>
</div>
<table name="mytable" id="mytable" border="1" style="margin:0 auto">
    <tr>
        <th>id</th>
        <th>姓名</th>
        <th>性别</th>
        <th>电话</th>
        <th>密码</th>
        <th>邮箱地址</th>
    </tr>
</table>
<script type="text/javascript">


    queryAllFunc();

    function queryAllFunc() {

        $.ajax({
            url: "queryAllDriver.do",
            type: "GET",
            data: {
                id: $("#id").val(),
                name: $("#name").val()
            },
            dataType: "json",
            success: function (data) {
                var str = "";
                str += "<tr>";
                str += "<th>id</th>";
                str += "<th>姓名</th>";
                str += "<th>性别</th>";
                str += "<th>电话</th>";
                str += "<th>密码</th>";
                str += "<th>邮箱地址</th>";
                str += "<th>操作</th>";
                str += "</tr>";
                for (var i = 0; i < data.length; i++) {
                    str += "<tr>";
                    str += "<td>" + data[i].id + "</td>";
                    str += "<td>" + data[i].name + "</td>";
                    str += "<td>" + data[i].sex + "</td>";
                    str += "<td>" + data[i].phone + "</td>";
                    str += "<td>" + data[i].password + "</td>";
                    str += "<td>" + data[i].email + "</td>";
                    str += "<td><button onclick='deleteDriver(" + data[i].id + ")'>删除</button></td>";
                    str += "</tr>";

                }
                $("#mytable").html(str);
            }


        });

    }


    $("#btn").click(function () {
        queryAllFunc();


    });

    function deleteDriver(id) {
        $.ajax({
            url: "deleteDriver.do",
            type: "GET",
            data: {id: id},
            dataType: "text",
            success: function (text) {

                queryAllFunc();

            }
        });
    }

</script>
</body>
</html>


